function [y] = zfilter(x, n, fircoef, firn)
    x_pointer = 0;
    x_buff = zeros(1, firn);
    for i = 0 :(n - 1)
        if(x_pointer >= firn)
          x_pointer = 0;
        end
         x_buff(x_pointer + 1) = x(i + 1);
         x_pointer = x_pointer + 1;
        rt = 0;
        xp = x_pointer;
        for j = 0: (firn - 1)
          if(xp >= firn)
             xp = 0;
          end
          rt = rt + fircoef(j + 1) * x_buff(xp + 1);
          xp = xp + 1;
        end
        ly(i + 1) = rt;
    end
    y = ly;
end
